<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
    <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#deviceAlarm')}">
        <fieldset>
            <div style="margin:0; padding:1px 5px 5px;">
                <span>报警信息：</span>
                <input type="text" name="info" class="form-control" size="10">
                <span>上报时间:</span>
                <input type="text" value="" name="createdatestart" data-toggle="datepicker" placeholder="点击选择日期">
                <span>至</span>
                <input type="text" value="" name="createdateend" data-toggle="datepicker" placeholder="点击选择日期">
                &nbsp;<button type="submit" class="btn-green" data-icon="search">开始搜索！</button>
                <button type="reset" class="btn-orange" data-icon="times">重置</button>
                <button onclick="clearAllData()" type="button" class="btn-red" data-icon="del">清空报警</button>
            </div>
        </fieldset>
    </form>
</div>
<div class="bjui-pageContent">
    <table class="table table-bordered" id="deviceAlarm" data-toggle="datagrid" data-options="{
        height: '100%',
        local: 'remote',
        dataUrl: '/sysmanage/devicealarm/listdata.do',
        paging: {pageSize:20, pageCurrent:1},
        linenumberAll: false,
        filterThead:false,
        inlineEditMult:false,
        sortAll: false

    }">
        <thead>
        <tr>
            <th data-options="{name:'id',align:'center' }" width="100px">id</th>
            <th data-options="{name:'sn',align:'center'}" width="180px">sn</th>
            <th data-options="{name:'info',align:'center'}" width="150px">报警信息</th>
            <th data-options="{align:'center',render:'setcreatedate'}"
                width="180px">创建时间
            </th>
        </tr>
        </thead>
    </table>
</div>
<script type="text/javascript">
    function setcreatedate(value, data) {
        return formatDate(new Date(data.createdate));
    }

    //清空数据
    function clearAllData() {
        $.ajax({
            type: "POST",
            url: "/sysmanage/devicealarm/flushAlarm.do",
            cache: true,
            async: false,
            dataType: 'JSON',
            success: function (data) {
                if(data.content=="ok"){
                    BJUI.alertmsg(data.content,data.message);
                    BJUI.navtab("fresh","devicewarm");
                    alarmNum();
                }
            }
        })
    }

</script>